<template>
    <div  >
       <div id="main2" class="Customized " ></div>
    </div>
</template>

<script>
import echarts from 'echarts'
export default {
  name: 'HomeCustomized',
  props: {
    schooltypeNumber: Object
  },
  data () {
    return {
    }
  },
  watch: {
    schooltypeNumber: {
      handler: function () {
        this.creatmap()
      },
      deep: true
    }
  },
  mounted () {
    this.creatmap()
  },
  methods: {
    creatmap () {
      var chartDom = document.getElementById('main2')
      var myChart = echarts.init(chartDom)
      var option2

      option2 = {
        title: {
          text: '一流高校类别比例',
          subtext: this.schooltypeNumber.title,
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: '高校数量',
            type: 'pie',
            radius: '50%',
            data: [
              {value: this.schooltypeNumber.A, name: 'A类高校'},
              {value: this.schooltypeNumber.B, name: 'B类高校'},
              {value: this.schooltypeNumber.subject, name: '一流学科建设高校'}
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }

      myChart.setOption(option2)
    }
  }

}
</script>

<style scoped>
.Customized{
    position: absolute;
    width: 490px;
    height: 340px;
    left:1050px;
}

</style>>
